# 创建字典: 因为车次是不能重复的，所以使用字典存贮
# dict1 = {'车次': ['出发站-到达站','出发时间','到达时间','历时']}
# dict2 = {'T40': ['长春-北京','00:12','12:20','12:08']}
# dict3 = {'T298': ['长春-北京','00:06','10:50','10:44']}
# dict4 = {'Z158': ['长春-北京','12:48','21:06','08:18']}
# dict5 = {'Z62': ['长春-北京','21:58','06:08','8:20']}

# 使用元组：因为元组是不可变序列，只是显示，效率高
# system = dict(zip(dict1, dict2, dict3, dict4, dict5))
dicts = {
    '车次':  ['出发站-到达站', '出发时间', '到达时间', '历时'],
    'T40':  ['长春-北京', '00:12', '12:20', '12:08'],
    'T298': ['长春-北京', '00:06', '10:50', '10:44'],
    'Z158': ['长春-北京', '12:48', '21:06', '08:18'],
    'Z62':  ['长春-北京', '21:58 ', '06:08', '8:20']
}
# spaceStr = '-----|||||+++++=====^^^^^'
spaceStr = '                    '
print(len(spaceStr))
slicelen = 20
for key, value in dicts.items():
    key = key + spaceStr[0:slicelen-len(key.encode('gbk'))]
    value = [x+spaceStr[0:slicelen-len(x.encode('gbk'))] for x in value]
    print(key, spaceStr[0:1].join(value))

train = input('请输入要购买的车次: ')
if train in dicts:
    passengers = input('请输入乘车人（用逗号分隔）: ')
    train = train.strip()
    take = dicts[train]
    result = '你已购买' + train + '次列车' + \
        take[0] + take[1] + '开, 请' + passengers + '尽快换取纸质车票.【铁路客服】'
    print(result)
else:
    print('没有找到车次', train)